---
title: Mem0 Tools
---

## Code

```python cookbook/tools/mem0_tools.py
from agno.agent import Agent
from agno.tools.mem0 import Mem0Tools

agent = Agent(
    instructions=[
        "You are a memory-enhanced assistant that can remember information across conversations",
        "Store important information about users and their preferences",
        "Retrieve relevant memories to provide personalized responses",
    ],
    tools=[Mem0Tools(user_id="user_123")],
    markdown=True,
)

agent.print_response("Remember that I prefer vegetarian meals and I'm allergic to nuts")
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set your API keys">
    ```bash
    export MEM0_API_KEY=your-mem0-api-key
    export MEM0_ORG_ID=your-organization-id
    export MEM0_PROJECT_ID=your-project-id
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="Install libraries">
    ```bash
    pip install -U mem0ai openai agno
    ```
  </Step>

  <Step title="Run Agent">
    <CodeGroup>
    ```bash Mac
    python cookbook/tools/mem0_tools.py
    ```

    ```bash Windows
    python cookbook/tools/mem0_tools.py
    ```
    </CodeGroup>
  </Step>
</Steps>
